/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test;

/**
 *
 * @author TQNINH
 */

class NamedThread implements Runnable {
    String name;
    
    public void run(){
        int count = 0;
        while(count < 3){
            name = Thread.currentThread().getName();
            System.out.println(name);
            count++;
        }
    }
}

public class ThreadRunnable {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        NamedThread objNewThread = new NamedThread();
        Thread objThread = new Thread(objNewThread);
        objThread.start();
    }
}
